using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace SideShow.Channel.Messages
{
    [Serializable]
    class RemoveContentMessage : Message
    {
        private Guid _applicationId;
        private Guid _endpointId;
        private uint _contentId;

        public RemoveContentMessage()
        {
        }

        public RemoveContentMessage(Guid applicationId, Guid endpointId, uint contentId)
            : base(ChannelMessages.RemoveContent)
        {
            _applicationId = applicationId;
            _endpointId = endpointId;
            _contentId = contentId;
        }

        public Guid ApplicationId
        {
            get { return _applicationId; }
        }

        public Guid EndpointId
        {
            get { return _endpointId; }
        }

        public uint ContentId
        {
            get { return _contentId; }
        }

        protected internal override void SerializeObject(BinaryWriter writer)
        {
            base.SerializeObject(writer);
            writer.Write(_applicationId.ToByteArray());
            writer.Write(_endpointId.ToByteArray());
            writer.Write(_contentId);
        }

        protected internal override void DeserializeObject(BinaryReader reader)
        {
            base.DeserializeObject(reader);
            _applicationId = new Guid(reader.ReadBytes(16));
            _endpointId = new Guid(reader.ReadBytes(16));
            _contentId = reader.ReadUInt32();
        }
    }
}
